#include "gather_task.h"
#include "stdio.h"
TaskHandle_t gatherHandler;

//书写心跳任务需要外设进行初始化
void init_gather()
{
	  DHT11_Init();
	  ADCx_Init();
	  rainInit();
}

void gather_task(void* param)
{		u16 value;
    while(1)
    {
			//读取dth11采集的数据
       /*
       u8 temp; u8 humi;
       DHT11_Read_Data(&temp,&humi);
       printf("read data: %d , %d \r\n",temp,humi);
        
        value=Get_ADC_Value(ADC_Channel_9,1);
        printf("检测AD值为：%d\r\n",value);
        value=100-value/40;
        if(value>=100)value=100;
         printf("read data: %d , %d \r\n",value);
       
         value=Get_ADC_Value(ADC_Channel_8,1);
        printf("检测AD值为：%d\r\n",value);
        value=value/40;
        if(value>=100)value=100;
         printf("read data: %d \r\n",value);
         */
         printf("read data: %d \r\n",DATA_PIN_READ);
			  vTaskDelay(2000);
    
    }
}
// 创建心跳任务
void createGatherTask()
{
    xTaskCreate(gather_task,"gather_task",
        128,NULL,2,&gatherHandler);
}
